// reducer 迭代实现
const flatter = (arr) => {
    return arr.reduce((pre,num) => 
        pre.concat(Array.isArray(num) ? flatter(num) : num)
    ,[])
}

console.log(flatter([1,2,[3,4,[5,6]]]))